package com.heatup.apt.common.constants;

import com.heatup.apt.common.util.StringUtil;

/**
 * 用户相关常量
 * @author Jindaodaxia
 *
 */
public class UserConstants {
	
	public static final int SEND_CHECK_CODE_INTERVAL = 60;   //验证码发送间隔(秒)
	public static final int CHECK_CODE_TIMEOUT = 60*10;   	//验证码有效期(秒)
	public static final int CHECK_CODE_MAX_SEND_COUNT = 20; //验证码每天发送限额（每人）
	public static final int CHECK_CODE_MANAGEMENT_MAX_SEND_COUNT = 100; //验证码管理后台每天发送限额（每人）

	public enum UserLevel {
		user(1,"1","普通用户"),
		vip(2,"2","檬会员");
		
		private int index;
		private String type;
		private String title;
		
		UserLevel(int index,String type,String title){
			this.index = index;
			this.type = type;
			this.title = title;
	    }
		
		public static UserLevel getUserLevel(String type){
			if(StringUtil.isEmpty(type))
				return null;
			for(UserLevel userLevel :UserLevel.values()){
				if(StringUtil.isEquals(userLevel.getType(), type)){
					return userLevel;
				}
			}
			return null;
		}

		public int getIndex() {
			return index;
		}
		public void setIndex(int index) {
			this.index = index;
		}

		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}
	}
	
	
	
}
